package com.huawei.appmarket.service.externalapi.actions;

import android.text.TextUtils;
import com.huawei.appgallery.search.api.ISearchActivityProtocol;
import com.huawei.secure.android.common.intent.SafeIntent;
import o.dyr;
import o.dys.a;
import o.epr;
import o.fho;
import o.fjb;

public class SearchAction extends dyr {
    private static final String KEYWORD_TAG = "keyWord";
    private static final String NEEDSEARCH_TAG = "needsearch";
    private static final String TRACE_ID = "trace_id";
    private String thirdId;

    public SearchAction(a aVar) {
        super(aVar);
    }

    public void onAction() {
        SafeIntent safeIntent = new SafeIntent(this.callback.getIntent());
        this.thirdId = safeIntent.getStringExtra("thirdId");
        epr.ˎ().ˎ(this.thirdId);
        dailyReport(this.thirdId);
        fjb ˎ = fho.ˏ().ˋ("Search").ˎ("Search");
        ISearchActivityProtocol iSearchActivityProtocol = (ISearchActivityProtocol) ˎ.ˊ();
        Object stringExtra = safeIntent.getStringExtra(TRACE_ID);
        if (!TextUtils.isEmpty(stringExtra)) {
            iSearchActivityProtocol.setTraceId(stringExtra);
        }
        stringExtra = safeIntent.getStringExtra(KEYWORD_TAG);
        if (TextUtils.isEmpty(stringExtra)) {
            stringExtra = safeIntent.getStringExtra("suggest_intent_query");
        }
        boolean booleanExtra = safeIntent.getBooleanExtra(NEEDSEARCH_TAG, true);
        if (!TextUtils.isEmpty(stringExtra) && booleanExtra) {
            iSearchActivityProtocol.setIntentKeyword(stringExtra);
            iSearchActivityProtocol.setNeedSearch(true);
        }
        this.callback.ˏ(ˎ, null);
        this.callback.finish();
    }
}
